<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <script src="jquery-3.6.0.min.js"></script>
  <style>
    .first { background-color: black; }
    .second { width: 200px; height: 100px; border: 2px solid red; }
    .third { position: absolute; left: 50px; }
  </style>
</head>
<body>
  <div></div>
  <script>
    // 添加first类和second类
    $('div').addClass('first second');
    // 删除first类
    $('div').removeClass('first');
    // 切换third类
    $('div').toggleClass('third');
  </script>
</body>
</html>